package it.xiuxian.homepage.presenter

import com.lzy.okgo.OkGo
import it.xiuxian.homepage.activity.QianDaoRecordActivity
import it.xiuxian.homepage.bean.RecordDetailBean
import it.xiuxian.lib.base.BaseBean
import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.EncodeUtils
import org.json.JSONObject

class QianDaoRecordActivityPresenter:BasePresenter<QianDaoRecordActivity>() {
    fun getDetail(pageNo:String){
        var json1 = JSONObject()
        json1.put("pageNo",pageNo)
        OkGo.post<BaseBean<RecordDetailBean>>(HttpConfig.BASE_URL+"/appqiandao/list")
            .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
            .execute(object : CallBackOption<BaseBean<RecordDetailBean>>() {}.loadBind(mView as QianDaoRecordActivity).execute(
                object : ILoadBind<BaseBean<RecordDetailBean>> {
                    override fun excute(bean: BaseBean<RecordDetailBean>) {
                        if(bean.code==0){
                            //ToastUtil.showShort(bean.msg)
                            (mView as QianDaoRecordActivity).setData(bean.data)

                        }
                    }
                }
            ))
    }
    
}